package com.wuyan.locationdog.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;

import androidx.annotation.Nullable;

import com.blankj.utilcode.util.ScreenUtils;

public class HalfWidthView extends View {

    public HalfWidthView(Context context) {
        super(context);
    }

    public HalfWidthView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        // 获取父容器为我们提供的尺寸


        // 设置自定义View的尺寸，一半宽度，和父容器的全高
        setMeasuredDimension(ScreenUtils.getScreenWidth() / 2, 0);
    }
}

